package com.ophiux.cs.application.core;

import java.util.List;

import com.ophiux.cs.domain.core.Page;

/**
 * 说明：查询结果列表   返回API层   Result<ResponsePage<T>><br>
 * <h1>创 建 人: hehailong<br></h1>
 * 创建日期: 2018年9月4日 下午3:11:04<br>
 * 修改记录：
 */
public class ResponsePage<T extends PageItem> extends DTO {
	String start;
	String length;
	List<T>  data;
	int draw;
	int recordsTotal;
    int recordsFiltered;
	String order_column;
	String order_dir;
	int end;
	
	public <B extends Page> void  initData(List<T> _data,int totalNum, B page) {
		this.start=page.getPAGE_INDEX();
		this.length=page.getPAGE_NUM();
		this.data=_data;
		this.recordsTotal=totalNum;
		this.recordsFiltered=totalNum;
		this.order_column=page.getORDER_COLUMN();
		this.order_dir=page.getORDER_DIR();
		this.end=0;
		
		int count = 0;
		for(T item : this.data){
			count ++ ;
			item.setXh((Integer.parseInt(this.start)+count)+"");
		}
	}

	public String getStart() {
		return start;
	}

	public void setStart(String start) {
		this.start = start;
	}

	public String getLength() {
		return length;
	}

	public void setLength(String length) {
		this.length = length;
	}

	public List<T> getData() {
		return data;
	}

	public void setData(List<T> data) {
		this.data = data;
	}

	public int getDraw() {
		return draw;
	}

	public void setDraw(int draw) {
		this.draw = draw;
	}

	public int getRecordsTotal() {
		return recordsTotal;
	}

	public void setRecordsTotal(int recordsTotal) {
		this.recordsTotal = recordsTotal;
	}

	public int getRecordsFiltered() {
		return recordsFiltered;
	}

	public void setRecordsFiltered(int recordsFiltered) {
		this.recordsFiltered = recordsFiltered;
	}


	public String getOrder_column() {
		return order_column;
	}

	public void setOrder_column(String order_column) {
		this.order_column = order_column;
	}

	public String getOrder_dir() {
		return order_dir;
	}

	public void setOrder_dir(String order_dir) {
		this.order_dir = order_dir;
	}

	public int getEnd() {
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}
	
}
